#pragma once

#include "config.h"
#include "singleTon.h"

typedef enum
{
	LOG_LEVEL_WARNING = 0,
	LOG_LEVEL_ERROR,
}LOGLEVEL;

const int LOG_BUFFER_SIZE = 64 * 1024;
const LOGLEVEL LOG_LEVEL = LOG_LEVEL_WARNING;
const char LOG_FILE_NAME[] = "log.log";

class Log
{
	friend class SingleTon<Log>;

	Log();

	bool Printf(char* strMsg, ...);

public:
	
	~Log();

	void Logout(LOGLEVEL logLevel, char* file, int line, char* function, char* strMsg, ...);
};

#define sLog		SingleTon<Log>::Instance()

#define ELOG(...)	sLog.Logout(LOG_LEVEL_ERROR, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
#define DLOG(...)   sLog.Logout(LOG_LEVEL_WARNING, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)

#define LOGOUT(...)	sLog.Logout(LOG_LEVEL_WARNING, __FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)